import React, { Component } from 'react'
import CartItem from './CartItem';
import CartTotal from './CartTotal';


export default class CartList extends Component {
  state = {
    allChecked: false
  }
  render() {
    let { list } = this.props;


    return (
      <div className="index">
        <header>
          <h2>购物列表</h2>
        </header>
        <main>
          {
            list.filter((item) => item.num).map((item, index) => {
              return <CartItem key={index} {...this.props} item={item} index={index}></CartItem>
            })
          }
          <CartTotal {...this.props}></CartTotal>
        </main>

      </div>
    )
  }
}



